/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projekt;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Mikael
 */
public class NewLevel extends JFrame {

    private final int sizeX = 600;
    private final int sizeY = 400;
    private int scoreX = 100;
    private int scoreY = 40;
    private Dungeon dg;
    private BufferedImage img;

    /**
     * Game over constructor.
     */
    public NewLevel(Dungeon dgx) {
        dg = dgx;
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (dim.width - sizeX) / 2;
        int y = (dim.height - sizeY) / 2;

        JPanel jpanel1 = new JPanel();
        try {
            img = ImageIO.read(new File("src/projekt/Image/castle2.jpg"));
        } catch (IOException e) {
            System.out.println("file not found");
        }
        JLabel jimg = new JLabel(new ImageIcon(img));

        setLocation(x, y);
        setTitle("Diablo 0.5");
        setSize(sizeX, sizeY);
        setResizable(false);
        setBackground(Color.BLACK);
        jpanel1.setBackground(Color.BLACK);
        jpanel1.setForeground(Color.WHITE);
        setVisible(true);
        toFront();
        setAlwaysOnTop(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JLabel label1 = new JLabel("Congratulations.");
        JLabel label2 = new JLabel("Press Enter for the next level.");
        jpanel1.add(label1);
        jpanel1.add(label2);
        jpanel1.add(jimg);
        this.add(jpanel1);
        this.addKeyListener(new KeyListener() {
            @Override
            public void keyTyped(KeyEvent e) {
            }

            @Override
            public void keyPressed(KeyEvent e) {
                if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                    dg.startLevel();

                }

            }

            @Override
            public void keyReleased(KeyEvent e) {
            }
        });
    }
}
